var form;
var $;
var table;
var layer;
layui.use(['form','jquery','table','layer'],function() {
    form = layui.form;
    $ = layui.$;
    table = layui.table;
    layer = layui.layer;

    var fanKui =JSON.parse(localStorage.getItem("fanKui"));
    console.log(fanKui);

    if(fanKui.feedbackType == 2){
        fanKui.feedbackType = "视频反馈";
    }else if(fanKui.feedbackType == 3){
        fanKui.feedbackType == "商品反馈";
    }else if(fanKui.feedbackType == 4){
        fanKui.feedbackType == "其他反馈";
    }

    if(fanKui.feedbackClassification == 2){
        fanKui.feedbackClassification = "很好";
    }else if(fanKui.feedbackClassification ==3){
        fanKui.feedbackClassification = "好";
    }else if(fanKui.feedbackClassification == 4){
        fanKui.feedbackClassification = "一般";
    }else if(fanKui.feedbackClassification == 5){
        fanKui.feedbackClassification = "差";
    }
    $("input[name = userAccount]").val(fanKui.userId);
    $("input[name = FeedbackType]").val(fanKui.feedbackType);
    $("input[name = OpinionType]").val(fanKui.feedbackClassification);
    $("input[name = FeedbackTime]").val(fanKui.createDate);
    $("textarea[name = FeedbackContent]").val(fanKui.feedbackContent);

    //受理
    Accepted = function Accepted(){
        feedbackId = fanKui.feedbackId;
        console.log(feedbackId);
        layer.open({
            type: 1,
            title: "信息",
            content:"<div style='font-size: 15px ; margin:30px  ;'>您确定要受理此意见吗?</div>",
            area: ['300px', '200px'],
            btn: ['确定', '取消1'],
            yes: function (index, layero) {
                $.ajax({
                    url:'/UserFeedback/updateAccepted',
                    data:{"feedbackId": feedbackId},
                    success:function (data) {
                        console.log(data);
                        if(data){
                            layer.msg("修改成功");
                        }else{
                            layer.msg("修改失败");
                        }
                        layer.close(index);
                    }
                });
            },
            btn2: function (index, layero) {
                layer.close(index);
            }
        });
    }
    //取消
    quXiao = function  quXiao() {
        var layer = parent.layer;
        layer.close(layer.index);
    }
});